package com.activiti6.demo.webservicetask;

import org.apache.cxf.endpoint.Server;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

import javax.xml.ws.Endpoint;

/**
 * 运行后，访问：
 * http://localhost:9090/mpc?wsdl
 */
public class Main {

    public static void main(String args[]) throws Exception {
        DefaultMpcService service = new DefaultMpcService();
        //实例化一个MpcServiceImpl的对象，并在http://localhost:9090/mpc的地址中发布webservice
        javax.xml.ws.Endpoint.publish("http://localhost:9090/mpc", service);
        System.out.println("服务启动...");
        Thread.sleep(100 * 60 * 1000);//随意设个时间，不要立马退出程序，最好长一点
        System.exit(0);


//        DefaultMpcService calculator;
//        Server server;
//        calculator = new DefaultMpcService();
//        JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
//        svrFactory.setServiceClass(DefaultMpcService.class);
//        svrFactory.setAddress("http://localhost:9090/mpc");
//        svrFactory.setServiceBean(calculator);
//        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
//        svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
//        server = svrFactory.create();
//        server.start();
    }

}
